<?php
session_start();
class UserPageControl extends CI_controller {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('session');
    }

    function userPageControl() {
        parent::__construct();
        $this->load->model('userModel', '', TRUE);
        $this->load->helper(array('form', 'url'));
    }
    
    function login(){
    	if ($this->input->post('submit')) {
            $this->load->model('userModel');
            $this->userModel->login();
            redirect('home');
        }
        $this->load->view('loginForm');
    }

    function index() {
        $this->load->helper(array('form', 'url'));
        $this->load->view('loginForm');
    }

    function logout() {
        $this->session->unset_userdata('logged_in');
//        session_destroy();
        redirect('home', 'refresh');
    }
}